<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <include file="./Public/Admin/header.html" />
    <style>
        .row-fluid [class*="span"]{margin-left:0px;margin-bottom:10px;}
        #keyword {
            width: 280px;
        }
    </style>
</head>
<body>
<div id="main">
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="box">
                    <div class="box-title">
                        <div class="span4">
                            <h3><i class="icon-table"></i>志愿者列表</h3>
                        </div>

                    </div>

                    <div class="box-content">

                        <div class="row-fluid">
                            <div class="span10 control-group">
                                <div class="span5" style="width: 100%;">
                                    <a class="btn" href="{:U('Admin/User/edit')}?action=add&gid=<?php echo $_GET['gid']?>"><i class="icon-plus"></i>添加</a>
                                    <a class="btn" href="javascript:location.reload()"><i class="icon-refresh"></i>刷新</a>
                                    <a class="btn" attr="BatchDelInfo" title="删除"><i class="icon-trash"></i>批量删除</a>
                                </div>
                                <div class="btn-group pull-left clearfix ">
                                    <form action="{:U('Admin/User/impUser')}" method="get" class="form-horizontal" style="margin: 0px;">
                                        <form action="{:U('User/impUser')}" method="post" enctype="multipart/form-data">
                                            <input type="file" name="import"/>
                                            <input type="hidden" name="table" value="tablename"/>
                                            <input type="submit" value="导入"/>
                                        </form>
                                    </form>
                                </div>
                            </div>

                        </div>


                        <div class="row-fluid dataTables_wrapper" >
                            <table id="listTable" class="table table-bordered table-hover  dataTable">
                                <thead>
                                <tr>
                                    <th class='with-checkbox'>
                                        <input type="checkbox" class="check_all" /></th>

                                    <th>志愿者名称</th>
                                    <th>志愿者电话</th>
                                    <th>志愿者性别</th>
                                    <th style = "width:150px;">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="list" item="item">
                                    <tr>
                                        <td class="with-checkbox">
                                            <input type="checkbox" name="check" value="{$item.id}">
                                        </td>
                                        <td><?php echo $item['name']; ?></td>
                                        <td><?php echo $item['phone']; ?></td>
                                        <td><?php if($item['sex']==1):?>
                                        男
                                            <?php else:?>
                                            女
                                            <?php endif;?>
                                        </td>
                                        <td class='hidden-480'>
                                            <a href="{:U('Admin/User/edit')}?action=edit&id={$item.id}" class="btn" rel="tooltip" title="编辑"><i class="icon-edit">编辑</i></a>
                                            <a href="javascript:void(0);" class="btn" rel="tooltip" title="删除" attr="deltext_info_{$item.id}"><i class="icon-remove">删除</i></a>

                                        </td>
                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="span4">
                                    <div class="dataTables_info">
                                        <if condition="($count gt 0) ">
                                            共{$count}条记录，当前第{$nowPage}/{$totalPages}页
                                        </if>
                                    </div>
                                </div>
                                <div class="span8">
                                    {$page}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        //删除内容
        $("a[attr^='deltext_info_']").click(function(){
            var tmp = $(this).attr('attr').split('_');
            var ids = new Array();
            ids[0]=tmp[2];
            delText(ids);
        });
        $("[attr='BatchDelInfo']").click(function(){
            var check = $("input:checked");
            if(check.length<1){
                G.ui.tips.err('请选择删除项');
                return false;
            }
            var ids = new Array();
            check.each(function(i){
                ids[i] = $(this).val();
            });
            delText(ids);
        });
    });
    //删除内容
    function delText(ids){
        G.ui.tips.confirm_flag('您确定要删除吗?',function(){
            $.post("{:U('admin/User/del')}", {ids:ids},function(data){
                if (data.errno ==0)
                {
                    location.reload();
                } else {

                    G.ui.tips.err(data.error);
                }
            },'json');
        });
    }
</script>

</body>
</html>

